home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / bbsutil / wmail230.zip / WNODE220.ARJ / WNLDEMO.PAS next >
Pascal/Delphi Source File  |  1992-12-28  |  4KB  |  153 lines

  1. Program WNLDemo;
  2. { Demo program for unit WNodelst.pas - See WNodelst.pas for reference }
  3.  
  4. Uses
  5.    Crt,WNodelst;
  6.  
  7. Procedure Split_Address(Address:String;Var Zone,Net,Node,Point:Integer);
  8. Var
  9.    MomStr:String[5];
  10.  
  11. Begin
  12.    Address:=Word_UpCase(Address);
  13.    If Copy(Address,1,3)='ALL' then
  14.    Begin
  15.       Zone:=-1;Net:=-1;Node:=-1;Point:=-1;
  16.    end
  17.    else
  18.    Begin
  19.       Address:=Address+' ';
  20.       Zone:=Val2(Copy(Address,1,Pos(':',Address)-1));
  21.       If Zone=0 then
  22.          Zone:=2;
  23.       Delete(Address,1,Pos(':',Address));
  24.       If copy(Address,1,3)='ALL' then
  25.       Begin
  26.          Net:=-1;
  27.          Node:=-1;
  28.          Point:=-1;
  29.       end
  30.       else
  31.       Begin
  32.          If Pos('/',Address)<>0 then
  33.             Net:=Val2(Copy(Address,1,Pos('/',Address)-1));
  34.          Delete(Address,1,Pos('/',Address));
  35.          If Pos('.',Address)<>0 then
  36.          Begin
  37.             Node:=Val2(Copy(Address,1,Pos('.',Address)-1));
  38.             If Address[1]='.' then
  39.             Begin
  40.                Net:=0;
  41.                Node:=0;
  42.             end;
  43.             Delete(Address,1,Pos('.',Address));
  44.             Point:=Val2(Copy(Address,1,Pos(' ',Address)-1));
  45.          end
  46.          else
  47.          Begin
  48.             MomStr:=Copy(Address,1,Pos(' ',Address)-1);
  49.             If MomStr='ALL' then
  50.                Node:=-1
  51.             else
  52.                Node:=Val2(MomStr);
  53.             Point:=0;
  54.          end
  55.       end
  56.    end
  57. end;
  58.  
  59.  
  60. Var
  61.    SysStr:String;
  62.    Find:FindNodeRec;
  63.    Zona,Net,Nodo,Point:Integer;
  64.    Ok:Boolean;
  65.    FlagStr:String;
  66.    Found:Integer;
  67.  
  68. Begin
  69.    Ok:=InitNodeList('d:\fd\nodelist'); { Place here your directory }
  70.    If Ok then
  71.    Repeat
  72.       ClrScr;
  73.       Writeln('Simple test program for W-Nodelist');
  74.       Writeln;
  75.       Writeln('1 - Search by Sysop''s name (FindFirstSysop)');
  76.       Writeln('2 - Search by address (FindFirstNode)');
  77.       Writeln('3 - Non-indexed search by flag');
  78.       Writeln('X - Exit');
  79.       Writeln;
  80.       Write('Selection (1,2,3,X):');
  81.       Readln(SysStr);
  82.       If SysStr='1' then
  83.       Begin
  84.          Write('Sysop''s name (or initial part of it):');
  85.          Readln(SysStr);
  86.          FindFirstSysop(SysStr,Find);
  87.          With Find.BBSRecord do
  88.          While SysopName<>'' do
  89.          Begin
  90.             Write(SysopName,' on ');
  91.             Writeln(Zone,':',Net,'/',Node,'.',Point,' - ',BBSName);
  92.             Writeln('Speed:',BaudRate,'  Flags:',Flags);
  93.             FindNextSysop(Find);
  94.          end;
  95.          Writeln('End of list. Press enter for more.');
  96.          Readln;
  97.       end
  98.       else
  99.       If SysStr='2' then
  100.       Begin
  101.          Write('Address (''ALL'' macros are ammitted):');
  102.          Readln(SysStr);
  103.          Split_Address(SysStr,Zona,Net,Nodo,Point);
  104.          FindFirstNode(Zona,Net,Nodo,Point,Find);
  105.          With Find.BBSRecord do
  106.          While SysopName<>'' do
  107.          Begin
  108.             Write(SysopName,' on ');
  109.             Writeln(Zone,':',Net,'/',Node,'.',Point,' - ',BBSName);
  110.             Writeln('Speed:',BaudRate,'  Flags:',Flags);
  111.             FindNextNode(Find);
  112.          end;
  113.          Writeln('End of list. Press enter for more.');
  114.          Readln;
  115.       end
  116.       else
  117.       If SysStr='3' then
  118.       Begin
  119.          Write('Write the flag you want to look for:');
  120.          Readln(SysStr);
  121.          Found:=0;
  122.          SysStr:=Word_UpCase(SysStr);
  123.          FindFirstNode(All,0,0,0,Find);
  124.          With Find.BBSRecord do
  125.          While SysopName<>'' do
  126.          Begin
  127.             FlagStr:=','+Flags+',';
  128.             If Pos(SysStr,','+FlagStr+',')<>0 then
  129.             Begin
  130.                Write(SysopName,' on ');
  131.                Writeln(Zone,':',Net,'/',Node,'.',Point,' - ',BBSName);
  132.                Writeln('Speed:',BaudRate,'  Flags:',Flags);
  133.                Inc(Found);
  134.                If Found mod 12=0 then
  135.                Begin
  136.                   Write('More...');
  137.                   Readln;
  138.                   Writeln;
  139.                end;
  140.             end;
  141.             FindNextNode(Find);
  142.          end;
  143.          Writeln('There are ',Found,' nodes with ',SysStr,' flag.');
  144.          Writeln('End of list. Press enter to continue.');
  145.          Readln;
  146.       end;
  147.    Until SysStr[1] in ['X','x']
  148.    else
  149.       Writeln(#7+'Check your nodelist files!');
  150.    CloseNodeListFiles;
  151.    ClrScr;
  152. end.
  153.